import { Router } from 'hyper-express';
import requireUser from '../../../middlewares/auth/requireUser';
import cache from '../../../middlewares/cache';
import rowLevelPermission from '../../../middlewares/auth/rowLevelPermission';
//#region AutoCreateCode
import { uctooUserHasRolesController } from '../../../controllers';
const uctoouserHasRolesRouter = new Router();
const userHasRolesController = new uctooUserHasRolesController();

uctoouserHasRolesRouter.post('/add', requireUser, userHasRolesController.add);
uctoouserHasRolesRouter.post('/edit', requireUser, rowLevelPermission('uctoo/user_has_roles'), userHasRolesController.edit);
uctoouserHasRolesRouter.post('/del', requireUser, rowLevelPermission('uctoo/user_has_roles'), userHasRolesController.delete);

//For getting userHasRoles with permission control
uctoouserHasRolesRouter.get('/:id', requireUser,  rowLevelPermission('uctoo/user_has_roles'), userHasRolesController.getSingle);
uctoouserHasRolesRouter.get('/:limit/:page', requireUser,  rowLevelPermission('uctoo/user_has_roles'), userHasRolesController.getMany);
uctoouserHasRolesRouter.get('/:limit/:page/:skip', requireUser,  rowLevelPermission('uctoo/user_has_roles'), userHasRolesController.getMany);

//#endregion AutoCreateCode
export default uctoouserHasRolesRouter;
